< previous page page_396 next page >

Page 396
0396-01.gif
Figure 12.17
Scaling an object at its lower left corner.
identity transformation. The identity transformation matrix leaves any point's coordinates unchanged.
e10a6a0a59f035e870d90cca05b85fce.gif
 z0416-01.gif
You can use the identity matrix to initialize the parts of a transformation that you will not be modifying. To build a scaling matrix, for example, you can start with the identity matrix and then modify the X and Y scaling terms.
The first of the subroutines that follow sets a transformation equal to the identity matrix. The next three routines use the identity matrix as the basis for creating simple translation, scaling, and rotation transformations.
e10a6a0a59f035e870d90cca05b85fce.gif
' Create a 2-dimensional identity matrix.
Public Sub m2Identity(M() As Single)
Dim i As Integer
Dim j As Integer

    For i = 1 To 3
        For j = 1 To 3
            If i = j Then
                M(i, j) = 1

 
< previous page page_396 next page >